#ifndef __WINDOW_H__
#define __WINDOW_H__
#include "DIALOG.h"
#include "ff.h"
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
int GetPic(void* p, const U8** ppData, unsigned NumBytes, U32 Off);
void CreateMainWindow(void);
void CreateMeasureWindow(void);
void CreateReplyWindow(void);
void CreateSettingWindow(void);
void CreateDispWindow(GUI_HWIN hWin, const char* Title);
void MainTask();

extern BUTTON_SKINFLEX_PROPS SkinFlexOrig[];

extern WM_HWIN hWin;
extern WM_HWIN hMea;
extern WM_HWIN hRep;
extern WM_HWIN hSet;

extern GUI_CONST_STORAGE GUI_BITMAP bmNoWIFI;
extern GUI_CONST_STORAGE GUI_BITMAP bmHaveWIFI;

extern GUI_CONST_STORAGE GUI_BITMAP bmReplyBox;
extern GUI_CONST_STORAGE GUI_BITMAP bmSetting;
extern GUI_CONST_STORAGE GUI_BITMAP bmMeasuare;

extern GUI_FONT UTF_8;
extern GUI_XBF_DATA UTF_8_Data;


extern FATFS fs;
extern FIL fil,font;
extern DIR dir;
extern FILINFO info;
extern FRESULT res;

typedef struct
{
	char DeskName[13];
	char WIFIName[32];
} Config_t;
typedef struct
{
	uint8_t Index;//命令索引
	uint8_t HighPressure;//高压
	uint8_t LowPressure;//低压
	uint8_t HeartRate;//心率
	uint8_t __reserved[2];//保留位
} BloodInfo_t;//传感器信息
typedef struct
{
	uint8_t* Data;//数据指针
	bool isDelete;//是否需要释放内存
	uint32_t Length;//数据长度
} UpLoadPacket_t;


extern Config_t Config;
extern const char* cn[];

/*Mesuare*/
extern SemaphoreHandle_t StartMesuare;
extern bool ExitMesuare;
extern TEXT_Handle hTextMesuare[8];
extern BUTTON_Handle hButtonExitMesuare,hButtonUpload;
extern GRAPH_DATA_Handle hData;

/*Set*/
extern TEXT_Handle thWIFI;

/*Common*/
extern SemaphoreHandle_t NetworkRecive,NetworkSendDone,uploadSucc;
extern SemaphoreHandle_t NewDataReady;
extern QueueHandle_t NetworkUpload;
extern uint16_t Data[4];
void SmartConfig_Task(void *para);
extern bool isSystemRun;
#endif
